//
//  PutNormolForIPadCell.m
//  RoadMaintain
//
//  Created by 岳学坤 on 2017/3/8.
//  Copyright © 2017年 岳学坤. All rights reserved.
//

#import "PutNormolForIPadCell.h"

@implementation PutNormolForIPadCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        self.selectionStyle = UITableViewCellSelectionStyleNone;
        
        [self setUI];
    }
    return self;
}
- (void)setUI{
    self.bgView = [[UIView alloc]init];
    self.bgView.layer.borderColor = [Line_Color CGColor];
    self.bgView.layer.borderWidth = 1;
    self.bgView.layer.cornerRadius = 5;
    self.bgView.layer.masksToBounds = YES;
    [self.contentView addSubview:self.bgView];
    [self.bgView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.bottom.mas_equalTo(-6*PadHeightRate);
        make.left.mas_equalTo(23*PadWidthRate);
        make.right.mas_equalTo(-23*PadWidthRate);
        make.height.mas_equalTo(36*PadHeightRate);
    }];
    
    self.titleLab = [[UILabel alloc]init];
    self.titleLab.textColor = Black_Color;
    self.titleLab.font = [UIFont systemFontOfSize:13*PadZitiRate];
    [self.bgView addSubview:self.titleLab];
    [self.titleLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.mas_equalTo(0);
        make.height.mas_equalTo(36*PadHeightRate);
        make.left.mas_equalTo(12*PadWidthRate);
        make.width.mas_equalTo(85*PadWidthRate);
    }];
    
    self.img = [[UIImageView alloc]init];
    [self.bgView addSubview:self.img];
    [self.img mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.mas_equalTo(0);
        make.right.mas_equalTo(-5*PadWidthRate);
        make.width.mas_equalTo(20*PadWidthRate);
        make.height.mas_equalTo(25*PadHeightRate);
    }];
    
    self.contentLab = [[UILabel alloc]init];
    self.contentLab.textColor = Gray_Color;
    self.contentLab.font = [UIFont systemFontOfSize:12*PadZitiRate];
    self.contentLab.textAlignment = 2;
    self.contentLab.numberOfLines =0;
    [self.bgView addSubview:self.contentLab];
    [self.contentLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.mas_equalTo(0);
        make.height.mas_equalTo(36*PadHeightRate);
        make.left.equalTo(self.titleLab.mas_right).offset(0);
        make.right.equalTo(self.img.mas_left).offset(0);
    }];
    
    self.btn = [UIButton buttonWithType:UIButtonTypeCustom];
    self.btn.hidden = YES;
    [self.btn setImage:[UIImage imageNamed:@"location"] forState:UIControlStateNormal];
    [self.btn addTarget:self action:@selector(location) forControlEvents:UIControlEventTouchUpInside];
    [self.bgView addSubview:self.btn];
    [self.btn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.mas_equalTo(0);
        make.right.mas_equalTo(-5*PadWidthRate);
        make.width.mas_equalTo(30*PadWidthRate);
        make.height.mas_equalTo(45*PadHeightRate);
    }];
}
- (void)location{
    if ([self.delegate respondsToSelector:@selector(locationForIPadWithIndexPath:)]) {
        [self.delegate locationForIPadWithIndexPath:self.indexPath];
    }
}
@end
